<!doctype html>
<html>
	<head>
		<meta charset="utf-8" />
		<title>管理后台 - Powered By Baby.com.cn</title>
		<link rel="shortcut icon" href="../favicon.gif" type="image/gif" />
		<link rel="stylesheet" href="/css/desktop/framework.css" type="text/css" media="screen, projection"/>
		<link rel="stylesheet" href="/css/desktop/component.css" type="text/css" media="screen, projection"/>
		<link rel="stylesheet" href="/css/desktop/button.css" type="text/css" media="screen, projection"/>
		<link rel="stylesheet" href="/css/desktop/form.css" type="text/css" media="screen, projection"/>
		<link rel="stylesheet" href="/css/desktop/gridlist.css" type="text/css" media="screen, projection"/>
		<link rel="stylesheet" href="/css/desktop/style.css" type="text/css" media="screen, projection"/>
		<link rel="stylesheet" href="/css/desktop/desktop_themes/default/style.css" type="text/css" media="screen, projection"/>
		<link rel="stylesheet" href="/css/desktop/treeList.css" type="text/css" media="screen, projection"/>
		<link rel="stylesheet" href="/css/customer/style.css" type="text/css" media="screen, projection"/>
		<link href="/css/ome/style.css?7ae952" rel="stylesheet" type="text/css" media="screen, projection" />
		<script>
			startTime = (new Date).getTime();
			currentWorkground = null;

			/*商店事件、状态 推送包*/
			shopeEvents = {};
			SESS_ID=null;
			SHOPBASE='<?php echo base_url();?>';
			SHOPADMINDIR='/';
			DESKTOPRESURL='/app/desktop/statics';
			//DESKTOPRESFULLURL='http://nb4.g.taoshopex.com/app/desktop/statics';
			DESKTOPRESFULLURL = '<?php echo base_url(); ?>';
			CURRENTUSER =  '<?php echo htmlspecialchars($user['username']);?>';
			BREADCRUMBS ='0:0';
			window.loadedPart = [1,0,(new Date).getTime()];
		</script>
	</head>
	<body>
		<noscript>
			<div class='noscript error'>您好，要正常运行管理后台，浏览器必须支持Javascript  </div>
		</noscript>

		<div class='loadpart' id='loadpart'>
			<div class='msg'>正在加载...</div>
			<div class='lpb'>
				<div class='lpp' id='loadpartprocess' style='height:5px;overflow:hidden;width:0px'>&nbsp;</div>
			</div>
		</div>

		<iframe src='/tpl.html?1.02' id='tplframe' class='hide'></iframe>
		<iframe src='/about.html' name='download' id='downloadframe' class='hide'></iframe>
		<iframe src='/about.html' name='upload' id='uploadframe' class='hide'></iframe>

		<div class="wrapper" id='body' style='visibility:hidden'>
			<div class="msgbox" id="messagebox"></div>
			<div class="header" id="header">
				<div class="header-inner clearfix">
				<div class="top-bar clearfix" id="topbar">
					<div class="span-7">
						<h1 class="logo">
							<a href="/dashboard/index">管理后台</a>
							<!--span id="license" class="head-license"></span-->
						</h1>
					</div>
					<div class="frt">
						<div class="head-opts flt">
							<div class="flt first">
								<div class="favor" id="favor" style="display:none;">
									<span class="favor-handle">快捷菜单</span>
									<div class="x-drop-menu" style="display:block;visibility:hidden;">
										<ul>
											<li><a href="/purchase/admin_inventory/confirm"><span>损益确认</span></a></li>
											<li><a href="http://www.baby.com.cn" target="_blank"><span>商城</span></a></li>
											<li><a href="http://www.paipai.com" target="_blank"><span>拍拍店铺</span></a></li>
											<li><a href="http://www.paipai.com" target="_blank"><span>淘宝店铺</span></a></li>
											<li><a href="http://weibo.com/aiyingdao" target="_blank"><span>新浪官方微博</span></a></li>
										</ul>
										<div style="height:22px;line-height:22px" class="x-edit-menu clear"> 
											<a onclick="new Dialog('index.php?app=desktop&ctl=default&act=allmenu',{'title':'快捷菜单配置'})" href="javascript:void(0)"><span>点此编辑快捷菜单</span></a>
										</div>
									</div>
								</div>
							</div>
							<div class="flt"><span style="display:none">|</span> </div>
							<div class="rpcnotify flt" style="display:none">
								<a href='index.php?ctl=rpcnotify&act=index'>系统通知</a><i class="notify_num"></i>
								<span>|</span>
							</div>
							<div class="flt" >
								<span style="display:none;"><a href='/desktop/appmgr/index'>应用中心</a></span>
								<?php if(check_auth()):?>
								<span><a href='/desktop/adminpanel'>控制面板</a></span>|
								<?php endif?>
								<span style="display:none;"><a href='/desktop/default/alertpages/?&goto=index.php%3Fapp%3Ddesktop%26ctl%3Drecycle%26act%3Dindex%26nobuttion%3D1' target='_blank'>垃圾桶</a></span>
								<span style="display:none;"><a href='/dashboard/index'>桌面</a></span>
								<span><a href="/dashboard/alert" target="dialog::{width:500,height:300,title:'故障申报'}">故障申报</a></span>
							</div>
						</div>
					<div class="head-user flt">
						<div class="span-auto"><span>|</span> </div>
						<?php echo htmlspecialchars($user['username']);?> [<a href="/dashboard/profile" target="dialog::{width:463,height:280,title:'设置'}" >设置</a>]
						[<a href='/passport/logout' target='_top'>退出</a>]
					</div>
				</div>
			</div>
		</div>
		<div class="head-nav clearfix">
			<div class="flt">
				<?php foreach($main_menu as $k=>$moduleMenu):?>
				<?php if(check_auth($k)):?>
				<dl>
					<dt><a href="<?php echo $moduleMenu['link'];?>" class="wg" mid="<?php echo $moduleMenu['mid'];?>"><span><?php echo htmlspecialchars($moduleMenu['label']);?></span></a></dt>
					<?php if(isset($moduleMenu['children'])):?>
					<dd>
						<ul>
							<?php $j=0;$cnt=count($moduleMenu['children']);?>
							<?php foreach($moduleMenu['children'] as $subMenu):?>
							<?php ++$j;?>
							<li<?php if($j==$cnt):?> class="last"<?php endif?>>
								<a class="head-nav-sub" href="javascript:void(0)"><span><?php echo htmlspecialchars($subMenu['label']);?></span></a>
								<ul>
									<?php $k=0;$cnt1=count($subMenu['children']);?>
									<?php foreach($subMenu['children'] as $menuItem):?>
									<?php ++$k;?>
									<li<?php if($k==$cnt1):?> class="last"<?php endif?>><a target="<?php if(isset($menuItem['_blank']) && $menuItem['_blank']){ echo '_blank';}?>"  href="<?php echo $menuItem['link'];?>" ><span><?php echo htmlspecialchars($menuItem['label']);?></span></a></li>
									<?php endforeach?>
								</ul>
							</li>
							<?php endforeach?>
						</ul>
					</dd>
					<?php endif?>
				</dl>
				<?php endif?>
				<?php endforeach?>
			</div>
			
			<div class="span-auto">&nbsp;</div>
			<div class="flt">
				<dl class="head-nav-setting" id="head-nav-setting" style="visibility:hidden;">
					<dt>
						<a href="index.php?app=desktop&ctl=default&act=main_menu_define" target="dialog::{title:'菜单定制',width:350,height:0.7}"><span>菜单定制</span>
&nbsp;<img src="/css/desktop/bundle/control.gif" class="imgbundle" />            </a>
					</dt>
				</dl>
			</div>
		</div>
	</div>

	<div class="container clearfix" id="container">
		<div class="side " id="side">
			<div class="side-inner">
				<div class="side-content"></div>
			</div>
		</div>
		<div class="toggler-left flt" id='leftToggler'>
			<a href="javascript:void(0)" class="toggler-left-inner" title="点击收起或展开左侧">&nbsp;</a>
		</div>
		<div class='workground' id='workground'>
			<div class='content-head'></div>
			<div class='content-main' id='main'>loading...</div>
			<div class='content-foot'></div>
		</div>

		<div class="side-r hide" id="side-r">
			<div class="side-r-top clearfix">
				<b class="side-r-title flt f-14"></b>
				<span class="frt side-r-close pointer"><img src="/img/desktop/finder_drop_arrow_close.gif" class="imgbundle" /></span>
			</div>
			<div class="side-r-head" style="border-bottom:1px #999 solid;padding:2px 0 2px 0;"></div>
			<div id="side-r-content" class="side-r-content" conatainer="true" style="overflow:auto"></div> 
			<div class="side-r-foot"></div>
		</div>
	</div>
</div>


<script>
	void function(){
		var win_loaded = false;
		this.loadedPart[0] += this.frames.length;
		var loadedCall = function(){
			if(win_loaded)return;
			(loadedPart[1])++;
			win_loaded = loadedPart[1];
		};
		window.onload = loadedCall;
		if('addEventListener' in document)
			document.addEventListener('DOMContentLoaded',loadedCall,false);
	}();

	var st=0;
	(function(){
		if(loadedPart[1]==loadedPart[0]){
			clearTimeout(st);
			document.getElementById('loadpart').style.display='none';
			document.getElementById('body').style.visibility='visible';
			return initDefaultPart();
		}
		document.getElementById('loadpartprocess').style.width = (loadedPart[1]/loadedPart[0])*100+'%';
		st = setTimeout(arguments.callee, loadedPart[3] - startTime+100);
	})();
</script>

<script type="text/javascript" src="/js/desktop/lang/zh-cn/lang.js?7ae952"></script>
<script type="text/javascript" src="/js/desktop/moo.js?7ae952"></script>
<script type="text/javascript" src="/js/desktop/moomore.js?7ae952"></script>
<script type="text/javascript" src="/js/desktop/mooadapter.js?7ae952"></script>
<script type="text/javascript" src="/js/desktop/jstools.js?7ae952"></script>
<script type="text/javascript" src="/js/desktop/coms/hst.js?7ae952"></script>
<script type="text/javascript" src="/js/desktop/coms/messagebox.js?7ae952"></script>
<script type="text/javascript" src="/js/desktop/coms/dialog.js?7ae952"></script>
<script type="text/javascript" src="/js/desktop/coms/validate.js?7ae952"></script>
<script type="text/javascript" src="/js/desktop/coms/wpage.js?7ae952"></script>
<script type="text/javascript" src="/js/desktop/coms/finder.js?7ae952"></script>
<script type="text/javascript" src="/js/desktop/coms/lazyload.js?7ae952"></script>
<script type="text/javascript" src="/js/desktop/coms/dropmenu.js?7ae952"></script>
<script type="text/javascript" src="/js/desktop/coms/cmdrunner.js?7ae952"></script>
<script type="text/javascript" src="/js/desktop/coms/datapicker.js?7ae952"></script>
<script type="text/javascript" src="/js/desktop/coms/colorpicker.js?7ae952"></script>
<script type="text/javascript" src="/js/desktop/coms/modedialog.js?7ae952"></script>
<script type="text/javascript" src="/js/desktop/coms/editor.js?7ae952"></script>
<script type="text/javascript" src="/js/desktop/coms/editor_style_1.js?7ae952"></script>
<script type="text/javascript" src="/js/desktop/coms/tagInput.js?7ae952"></script>
<!-- script type="text/javascript" src="/js/desktop/coms/uploader.js?7ae952"></script> --> 
<script type="text/javascript" src="/js/desktop/coms/autocompleter.js?7ae952"></script>
<script type="text/javascript" src="/js/desktop/fixie6.js?7ae952"></script>
<script type="text/javascript" src="/js/ome/omegoodseditor.js?7ae952"></script>
<script type="text/javascript" src="/js/desktop/fancyupload/Fx.ProgressBar.js"></script>
<script type="text/javascript" src="/js/desktop/fancyupload/Swiff.Uploader.js"></script>
<script type="text/javascript" src="/js/ome/common.js"></script>
		<script>
			var LAYOUT = {
				head: $('header'),
				container: $('container'),
				side: $('side'),
				workground: $('workground'),
				content_main: $('main'),
				content_head: $E('#workground .content-head'),
				content_foot: $E('#workground .content-foot'),
				side_r: $('side-r'),
				side_r_content:$('side-r-content'),
				leftToggler:$('leftToggler')
			};

			/*init  script
			this Function will run at 'loadedPart[1]==loadedPart[0]'
			*/
			var initDefaultPart = function() {
				fixLayout = function() {
					//console.log(new Date);
					var winSize = window.getSize();
					var _NUM = function(num){
						num =  isNaN(num)?0:num;
						if(num<0)num=0;
						return num;
					};

					$(document.body).setStyle('height',_NUM(winSize.y));

					var containerHeight = winSize.y - LAYOUT.head.getSize().y;

					LAYOUT.container.setStyle('height',_NUM(containerHeight-LAYOUT.container.getPatch().y));
					LAYOUT.container.setStyle('width',_NUM(winSize.x.limit(960, 2000)));
					LAYOUT.content_main.setStyle('height',_NUM(containerHeight - LAYOUT.content_head.getSize().y 
						- LAYOUT.content_foot.getSize().y  -LAYOUT.workground.getPatch().y) );

					if(!LAYOUT.side.hasClass('hide')){
						LAYOUT.side.setStyle('width',_NUM( (winSize.x * 0.12).limit(0,winSize.x)));
					}

					if(!LAYOUT.side_r.hasClass('hide')){
						if(!LAYOUT.side_r.get('widthset'))
							LAYOUT.side_r.setStyle('width',_NUM((winSize.x*0.15).limit(0,winSize.x)));

						LAYOUT.side_r_content.setStyle('height',
							_NUM(containerHeight-
							LAYOUT.side_r.getElement('.side-r-top').getSize().y-
							LAYOUT.side_r.getElement('.side-r-head').getSize().y-
							LAYOUT.side_r.getElement('.side-r-foot').getSize().y-
							LAYOUT.side_r_content.getPatch().y-
							LAYOUT.side_r.getPatch().y)
						);
					}
					LAYOUT.workground.setStyle('width',
						_NUM( (winSize.x - LAYOUT.workground.getPatch().x)-
							LAYOUT.leftToggler.getSize().x-
							LAYOUT.side.getSize().x-
							LAYOUT.side_r.getSize().x)
					);

					LAYOUT.content_main.setStyle('width',_NUM(LAYOUT.workground.getSize().x-LAYOUT.workground.getPatch().x));
				};

				window.addEvents({
					'resize': fixLayout
				});

				//window.fireEvent('resize');

				Side_R = new Class({
					Implements: [Options, Events],
					options: {
						onShow: $empty,
						onHide: $empty,
						onReady: $empty,
						width:false
					},
					initialize: function(url, opts) {
						this.setOptions(opts);
						this.panel = $('side-r');
						this.container = $('side-r-content');
						var trigger = this.options.trigger;
						if(trigger){			
							if(!trigger.retrieve('events',{})['dispose'])   
								trigger.addEvent('dispose',function(){
									$('side-r').addClass('hide');
									$('side-r-content').empty();
									$('side-r').removeProperty('widthset').store('url','');
								});
						}
		
						if(this.panel.retrieve('url','') == url)return;
						if (url) {
							this.showSide(url);
						} else {
							throw Exception('NO TARGET URL');
							return;
						}

						var btn_close = this.panel.getElement('.side-r-close');
						var _title = this.panel.getElement('.side-r-title');
						_title.set('html',this.options.title||"");
						if(btn_close){
							btn_close.removeEvents('click').addEvent('click', this.hideSide.bind(this));
						}
					},
					showSide: function(url) {
				  		this.cleanContainer();
				  		var _this = this;
		  				if(_this.options.width){
					  		_this.panel.set({'widthset':_this.options.width,styles:{width:_this.options.width}});
		 		 		}
		  				_this.panel.removeClass('hide');
		 		 		//    window.fireEvent('resize');
		 		 		_this.fireEvent('show');
		 		 		W.page(url,{
							update:_this.container, 
							render:false,
							onRequest: function() {
								// window.fireEvent('resize');
								_this.panel.addClass('loading');
							},
							onComplete: function() {
								window.fireEvent('resize');
								_this.panel.removeClass('loading');
								_this.fireEvent('ready', $splat(arguments));
								_this.panel.store('url',url);
	    						}
						});
					},
					hideSide: function() {
				  		this.panel.addClass('hide');
				  		window.fireEvent('resize');
				  		this.cleanContainer();
		  				this.fireEvent('hide');
			  		},
					cleanContainer: function() {
						this.panel.removeProperty('widthset').store('url','');
						this.container.empty();
					}
				});
	
				/*MODAL PANEL*/
				MODALPANEL = (function() {
					var mp = $pick($('MODALPANEL'), new Element('div', {
						'id': 'MODALPANEL'
					}).inject(document.body)).setStyle('display', 'none');

					var mpStyles = {
						'position': 'absolute',
						'background': '#333333',
						'width': '100%',
						'height': window.getScrollSize().y,
						'top': 0,
						'left': 0,
						'zIndex': 65500,
						'opacity': .4
					};
					mp.setStyles(mpStyles);
					mp.addEvent('onshow',function(el) {
						el.setStyles({
							'width': '100%',
							'height': window.getScrollSize().y
						});
					});
					return mp;
				})();

				window.addEvent('resize',function() {
					MODALPANEL.setStyles({
						'width': '100%',
						'height': window.getScrollSize().y
					});
				});

				$('leftToggler').addEvent('click',function(e) {
					if(this.hasClass('fixed'))return;

					LAYOUT.side.toggleClass('hide');

					var fcokk =  'desktop_'+CURRENTUSER+'_sideleft';

					if(!LAYOUT.side.hasClass('hide')){
						Cookie.dispose(fcokk);
					}else{
						Cookie.write(fcokk,'OFF-SHOW',{duration:365});
					}

					fixSideToggler();
					window.fireEvent('resize');
				});

				var fixSideToggler = (function(){
					LAYOUT.side.hasClass('hide')?$('leftToggler').getElement('.toggler-left-inner').addClass('hide'):
						$('leftToggler').getElement('.toggler-left-inner').removeClass('hide');

					return arguments.callee;
				})();

				fixSideLeft = function(act){
					$('leftToggler')[act+'Class']('fixed');

					if(Cookie.read('desktop_'+CURRENTUSER+'_sideleft'))return;

					LAYOUT.side[act+'Class']('hide');
					window.fireEvent('resize');
				};

				/*快捷菜单处理*/
				$('favor').addEvents({
					'mouseenter':function(){
						this.addClass('favor-active');
						var drop_menu=this.getElement('.x-drop-menu'),
						handle_h=this.getElement('.favor-handle').offsetHeight,
						drop_menu_h= window.getSize().y-handle_h;
						drop_menu.setStyles({
							top:handle_h-1,
							left:0,
							visibility:'visible'
						});

						if(drop_menu_h <= drop_menu.offsetHeight){
							var edit_menu=this.getElement('.x-edit-menu'),menu_h=drop_menu_h-drop_menu.getPatch().y;
							drop_menu.setStyle('height',menu_h).getElement('ul').setStyles({'overflow-y':'auto','height':menu_h-edit_menu.offsetHeight});
						}
					},
					'mouseleave':function(){
						this.removeClass('favor-active');
						this.getElement('.x-drop-menu').setStyles({
							visibility:'hidden',
							height:'auto'	
						}).getElement('ul').setStyle('height','auto');
					}
				});

				void function(){
					var winSize = window.getSize();
					var dmenu = $('favor').getElement('.x-drop-menu');
					dmenu.setStyle('width',winSize.x-$('favor').getPosition().x-dmenu.getPatch().x - 7);
					var favs = $$('#favor li');
					favs.pop();
					new Equalizer(favs).equalize('width');
				}();

				/*顶部菜单处理*/ 
				void function(){
					var _timer = 0;
					var _mouse = true;
					var _absoluteFix =  function(f,t){
						var pos =  {}; 
						var fcis = f.getCoordinates();
						var tsize = t.getSize();
						var wsize = window.getSize();
						if((wsize.x-fcis.right)<tsize.x){
							$extend(pos,{left:Math.abs(fcis.right-tsize.x),top:fcis.bottom});  
						}else{
							$extend(pos,{left:fcis.left,top:fcis.bottom});
						}
						return pos;
					}
					var getCurWgMenu =function(){return LAYOUT.head.getElement('a[mid='+BREADCRUMBS.split(":")[0]+']');}
					var lis = $$('.head-nav dl ul li li').addEvent('click',function(){
						this.getParent('dl').fireEvent('mouseleave');
						_mouse=false; 
					});
					new Equalizer(lis).equalize('width');//等宽
					$$('.head-nav')[0].addEvents({
						'mouseenter':function(){	
							$('head-nav-setting').fade(1);
						},
						'mouseleave':function(){
							$('head-nav-setting').fade(0);
						}
					});

					$$('.head-nav dl').addEvents({
						'mouseenter':function(){ 
							_mouse=true;
							$clear(_timer);
							var dd = this.getElement('dd');
							if(!dd)return;  
			
							if(wg = this.getElement('.wg')){
								if(cwg = getCurWgMenu()){
									if(wg.uid!=cwg.uid){ 
										cwg.removeClass('current');
									}
								}   
								wg.addClass('current');
							}
		
							dd.setStyle('visibility','visible');
							dd.setStyles(_absoluteFix(this,dd));
						},
						'mouseleave':function(e){
							if(!_mouse)return;  

							var dd = this.getElement('dd');
							if(!dd)return;
							var cwg = getCurWgMenu();    
							if(wg = this.getElement('.wg')){
								if(cwg&&e){
									if(wg.uid!=cwg.uid){
										_timer = cwg.addClass.delay(200,cwg,'current');
										wg.removeClass('current'); 
									}
								}else{      
									wg.removeClass('current'); 
								}
							}

							dd.setStyle('visibility','hidden'); 
							//dd.setPosition(this);
						}
					}); 
				}();

				/*每 30秒 同步一下后台 的事项*/
				EventsRemote = {
					url: "/dashboard/status",
     					timer: 30000,
   		  			delay: 0,
     					stop:function(){
	     					$clear(this.delay);
     					},
					start:function(){
	      					this.delay = this.doit.delay(this.timer, this);
      					},
					init: function() {
	      					var _this = this;
	     		 			this.request = (new Request.HTML({
							url:this.url,
							onSuccess: function(nodes, elements, responsetext, javascript) {
								$clear(_this.delay);
								_this.delay = _this.doit.delay(_this.timer, _this);
							},
							onCancel: function() {
								_this.delay = _this.doit.delay(_this.timer, _this);
							},
							onFailure: function() {
								_this.delay = _this.doit.delay(_this.timer * 2, _this);
	   						}
						}));
						return this;
					},
					doit: function(_chain) {
	   		   			_chain =$type(_chain)=='function'?_chain : $empty;
	      					return this.request.post({
							events: shopeEvents
						}).chain(_chain);
					}
				};

				EventsRemote.init().start();

				new LazyLoad({IE_show_alt:true}).loadCustomLazyData($('topbar'),'img');

				W = new Wpage();
				W.render(document.body);
				Xtip = new Tips();
			};//function end;

			function _get_rpcnotify_num(obj) {
				W.page('index.php?app=desktop&ctl=rpcnotify&act=read',{method:'POST',
					onComplete:function(){
						var notify=$E('#topbar .notify_num');
						if(notify){
							var msg=notify.get('text'),n;
							n=msg.substring(1,msg.length-1);
							n=n-1>0?'('+(n-1)+')':'';
							notify.set('text',n);
						}
					},data:{id:$(obj).getParent('tr').getElement('input').get('value')}
				});
			}
		</script>

		<script type="text/javascript" src="/js/desktop/desktop_themes/default/script.js"></script>
		<script type="text/javascript" src="/js/desktop/coms/pager.js?7ae952"></script>
		<script type="text/javascript" src="/js/desktop/coms/TreeList.js"></script>
		<script language="JScript.Encode" src="/js/browinfo.js"></script>
		<script language="JScript.Encode" src="/js/rtxint.js"></script>
		<script>
			function IMNRC(name) {
		                //if($.browser.msie) {
		                        RAP(name);
		                //}
		        }
		</script>
	</body>
</html>
